% !TEX program = xelatex
\documentclass{article}
\usepackage{xeCJK}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{nicematrix}
\usepackage{tikz}
\usepackage{mathabx}
\usepackage{pifont}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri,arrows.meta}

\title{离散数学作业(习题四)}
\author{2020141460280张家帅}

\begin{document}
\maketitle
\section*{习题四}
\subsection*{T3}
$A=\{\varnothing,\{0\},\{1\},\{2\},\{0,1\},\{1,2\},\{0,2\},\{0,1,2\}\}$

关系$xRy$对应的关系矩阵为：

\[
	M_R = \begin{bNiceMatrix}[first-row, first-col]
		{} 			& \varnothing 	&\{0\}	&\{1\}	&\{2\}	&\{0,1\}	&\{1,2\}	&\{0,2\}	&\{0,1,2\} 	\\
		\varnothing & 0				& 0 	& 0 	& 0 	& 0 		& 0 		& 0 		& 0			\\
		\{0\}		& 0 			& 1		& 0 	& 0 	& 1 		& 0 		& 1 		& 1			\\
		\{1\} 		& 0 			& 0 	& 1 	& 0 	& 1 		& 1 		& 0 		& 1			\\
		\{2\} 		& 0 			& 0 	& 0 	& 1 	& 0 		& 1 		& 1 		& 1			\\
		\{0,1\} 	& 0 			& 1 	& 1 	& 0 	& 1 		& 1 		& 1 		& 1			\\
		\{1,2\} 	& 0 			& 0 	& 1 	& 1 	& 1 		& 1 		& 1 		& 1			\\
		\{0,2\} 	& 0 			& 1 	& 0 	& 1 	& 1 		& 1 		& 1 		& 1			\\
		\{0,1,2\} 	& 0 			& 1 	& 1 	& 1 	& 1 		& 1 		& 1 		& 1
	\end{bNiceMatrix}
\]

关系$xRy$对应的关系图为：
\begin{figure}[!ht]
	\centering
	\scalebox{1.5}{
		\begin{tikzpicture}
			[
				dot/.style={circle,draw,inner sep=1.5pt},
				link/.style={<->},
				lbo/.style={out=-135},
				lao/.style={out=135},
				lbi/.style={in=-135},
				rao/.style={out=45},
				rai/.style={in=45},
				rbi/.style={in=-45}
			]
			\node[dot]	(no)	at (1.5,2)				{};
			\node[dot]	(0)		at (0,2)	{}
			edge [loop above] ();
			\node[dot]	(1)		at (0,1)	{}
			edge [loop above] ();
			\node[dot]	(2)		at (0,0)	{}
			edge [loop above] ();
			\node[dot]	(01)	at (3,2)	{}
			edge [loop above] ()
			edge [link,lbo,rbi,looseness=0.5] (0)
			edge [link,lbo,rai] (1);
			\node[dot]	(12)	at (3,1)	{}
			edge [loop above] ()
			edge [link] (1)
			edge [link,lbo,rai] (2)
			edge [link,rao,rbi] (01);
			\node[dot]	(02)	at (3,0)	{}
			edge [loop above] ()
			edge [link] (0)
			edge [link,lbo,rbi,looseness=1] (2)
			edge [link,lao,lbi] (01)
			edge [link,rao,rbi] (12);
			\node[dot]	(012)	at (1.5,0)	{}
			edge [loop above] ()
			edge [link,lao,rbi] (0)
			edge [link,lao,rbi] (1)
			edge [link] (2)
			edge [link,rao,lbi] (01)
			edge [link,rao,lbi] (12)
			edge [link] (02);

			\node [above] at (no.north) {$\varnothing$};
			\node [left] at (0.west) {$\{0\}$};
			\node [left] at (1.west) {$\{1\}$};
			\node [left] at (2.west) {$\{2\}$};
			\node [right] at (01.east) {$\{0,1\}$};
			\node [right] at (12.east) {$\{1,2\}$};
			\node [right] at (02.east) {$\{0,2\}$};
			\node [below] at (012.south) {$\{0,1,2\}$};
		\end{tikzpicture}
	}
\end{figure}
\subsection*{T10}
\subsubsection*{(2)}
由题已知，$R$是反自反的，即
\[(\forall x\in A)[(x,x)\notin R]\]
根据定义，$I_A$为集合$A$上的恒等关系，即
\[I_A=\{(x,y)\in A\times A|x=y\}\]
因此，我们可以得到
\[R\cap I_A=\{(x,y)\in A\times A|x=y\cap x\neq y\}=\varnothing\]
同理，如果已知$R\cap I_A=\varnothing$，那么可以得到
\begin{align}
	       & R\cap I_A=\{(x,y)\in A\times A|x=y\}=\varnothing\notag \\
	\iff{} & (\forall x\in A)[(x,x)\notin R] \notag
\end{align}
所以$R$是反自反的
\subsubsection*{(4)}
从左到右
\begin{align}
	              & (\forall x,y\in A)[((x,y)\in R\wedge(y,x)\in R)\rightarrow x=y]\notag           \\
	\Rightarrow{} & R=\{(x,y)\in A\times A|((x,y)\in R\wedge(y,x)\in R)\rightarrow x=y\}\notag      \\
	\Rightarrow{} & R^{-1}=\{(y,x)\in A\times A|((x,y)\in R\wedge(y,x)\in R)\rightarrow x=y\}\notag
\end{align}

假设存在$(x_i,y_i)\in R$，且$x_i\neq y_i$，那么必然会存在$(y_i,x_i)\in R^{-1}$，根据反对称性，$(y_i,x_i)\notin R$，得到$\forall (x,y)\in A\times A\wedge x\neq y,(x,y)\notin R\cap R^{-1}$.

所以$R\cap R^{-1}=\{(x,y)\in A\times A|(x,y)\in R\wedge x=y\}$，因此$R\cap R^{-1}\subseteq I_A$
\subsection*{T11}
由题：
\begin{align}
	 & R=\{(3,1),(4,2)\}\notag                   \\
	 & S=\{(1,2),(2,3),(3,4),(2,1),(4,2)\}\notag
\end{align}
得到：
\begin{align}
	 & R\circ S=\{(3,2),(4,3),(4,1)\}\notag               \\
	 & R\circ S^{-1}=\{(3,2),(4,1),(4,4)\}\notag          \\
	 & R^2=\varnothing\notag                              \\
	 & (s^{-1})^2=\{(2,2),(3,1),(4,2),(1,1),(1,4)\}\notag
\end{align}
\end{document}